local yuzhi = fk.CreateSkill {
  name = "ls__yuzhi",
  tags = { Skill.Compulsory },
}

Fk:loadTranslationTable{
  ["ls__yuzhi"] = "迂志",
  [":ls__yuzhi"] = "锁定技，你的手牌上限和黑色拼点牌点数+X（X为已受伤的角色数）。",

  ["$ls__yuzhi1"] = "道不同，不相谋。",
  ["$ls__yuzhi2"] = "你，恐怕只能是我的敌人。",
}


yuzhi:addEffect("maxcards", {
  correct_func = function(self, player)
    if player:hasSkill(yuzhi.name) then
      local n = 0
      for _, p in ipairs(Fk:currentRoom().alive_players) do
        if p:isWounded() then
          n = n + 1
        end
      end
      return n
    end
  end,
})

yuzhi:addEffect(fk.PindianCardsDisplayed, {
  anim_type = "special",
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(yuzhi.name) then
      if data.from == player then
        return data.fromCard.color == Card.Black
      elseif table.contains(data.tos, player) then
        return data.results[player].toCard.color == Card.Black
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local n = #table.filter(room:getAlivePlayers(), function (p)
      return p:isWounded()
    end)
    room:changePindianNumber(data, player, n, yuzhi.name)
  end,
})


return yuzhi